<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>新开卡或卡充值提成模板管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		global.loginPassword = "${fns:getLoginPw()}";
		$(document).ready(function() {
			$("#contentTable tbody tr").click(function(){
				sessionStorage.parentPageNo = $("#pageNo").val();
				operateMenu(this.id);
			});
			var currentSelectId = '${currentSelectId}';
			if(currentSelectId){
				$("#"+currentSelectId).addClass("opreationTR");
			} else {
				$("#contentTable tbody tr:first-child").addClass("opreationTR");
			}
		});
		function operateMenu(id){
			var item = $("#opreation-"+ id);
			if(item.length > 0) {
				item.remove();
				this.event.stopPropagation();
				return;
			}
			$(".opreationTR").removeClass("opreationTR");
			$(".opreation").remove();
			var html= "<tr id='opreation-" + id + "' class='opreation'><td colspan='6'>";
				html += '<a data-role="button" data-inline="true" href="${ctx}/employee/storeBonusSettingTemplateCard/form?id='+ id +'">修改</a>';
				html += '<a data-role="button" data-inline="true" href="${ctx}/employee/storeBonusSettingTemplateCard/delete?id='+ id +'" onclick="return confirmx(\'确认要删除该新开卡或卡充值提成设定吗？\', this.href)">删除</a>';
				html += '</td></tr>';
			$("#" + id).after(html);
			$("#" + id).addClass("opreationTR");
			$("#contentTable").trigger("create");
			this.event.stopPropagation();
		}
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div class="icon-buttons">
		<a data-role="button" data-inline="true" data-icon="back" data-iconpos="notext"  href="${ctx}/employee/employee/bonusList">返回</a>
	</div>
	<nav data-role="navbar">
	    <ul>
	        <li><a class="ui-btn-active" href="${ctx}/employee/storeBonusSettingTemplateCard/">新卡或充值卡提成模板设定</a></li>
	        <li><a href="${ctx}/employee/storeBonusSettingTemplateProduct/?type=0">产品提成模板设定</a></li>
	        <li><a href="${ctx}/employee/storeBonusSettingTemplateCare/?type=0">护理提成模板设定</a></li>
	    </ul>
	</nav>
	<form:form id="searchForm" modelAttribute="storeBonusSettingTemplateCard" action="${ctx}/employee/storeBonusSettingTemplateCard/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input type="button" value="新增模板设定" data-inline="true" onclick="loginPasswordPopup('${ctx}/employee/storeBonusSettingTemplateCard/add')">
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
		<thead><tr><th>会员卡类别</th><th>卡名</th><th>提成方式</th><th>提成比例</th><th>提成金额</th></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="storeBonusSettingTemplateCard">
			<tr id="${storeBonusSettingTemplateCard.id}">
				<td>${fns:getDictLabel(storeBonusSettingTemplateCard.card_template_type, "card_type", "")}</td>
				<c:set var="key" value="${storeBonusSettingTemplateCard.card_template_type}-${storeBonusSettingTemplateCard.card_template_id}"/> 
				<td>${cardNameMap[key]}</td>
				<td>${fns:getDictLabel(storeBonusSettingTemplateCard.bonus_type, "bonus_type", "")}</td>
				<td>${fns:changeDisCount(storeBonusSettingTemplateCard.bonus_rate)}%</td>
				<td>${storeBonusSettingTemplateCard.fixed_money}元</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
